package kuzmenkov.oip.service;

import kuzmenkov.oip.model.Module;
import org.richfaces.model.TreeNode;

/**
 * Interface describes choosing of modules. It serves the module choosing controller
 * User: Michael Kuzmenkov
 * Date: 18.03.2009
 * Time: 16:49:21
 */
public interface ModuleChoosingService {
    /**
     * A value of a primary key of a root method class. 
     */
    Long ROOT_NODE_ID = 0L;

    /**
     * Creates a tree of the modules
     *
     * @return the root node
     */
    TreeNode<String> createModuleTree() throws Exception;

    /**
     * Returns name of selected module
     *
     * @return null if a module isn't selected
     */
    String getModuleName() throws Exception;

    /**
     * Returns description of selected module
     *
     * @return null if a module isn't selected
     */
    String getModuleDescription() throws Exception;

    /**
     * Sets a current module which has a given id
     *
     * @param id
     */
    void setCurrentModule(Long id) throws Exception;

    /**
     * @return true if some module is selected
     */
    boolean isModuleSelection();

    /**
     * @return true if some method class is selected
     */
    boolean isClassSelection();

    /**
     * Sets a current method class which has a given id
     *
     * @param id
     */
    void setCurrentClass(Long id) throws Exception;

    /**
     * Returns name of a selected class. If a class isn't selected it returns null
     *
     * @return
     */
    String getClassName() throws Exception;

    /**
     * Returns description of a selected class. If a class isn't selected it returns null
     */
    String getClassDescription() throws Exception;

    /**
     * Returns name of a producer of a selected module. If a module isn't selected it returns null
     * @return
     */
    String getModuleProducerName() throws Exception;


    /**
     * 
     * @return a current image processing module
     */
    Module getCurrentModule();


    /**
     * 
     * @return a root node of a tree of image processing modules. 
     * @throws Exception
     */
    TreeNode<String> getRootNode() throws Exception;
}
